//
//  SlideSwitchView.h
//
//
//  Created by kiefer on 14-1-3.
//  Copyright (c) 2014年 kiefer. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol SlideSwitchViewDelegate;
@interface SlideSwitchView : UIView <UIScrollViewDelegate>
{
    UIScrollView *_scrollView;
    
    CGFloat _contentOffsetX;
    NSUInteger _selectedIndex;
    BOOL _isLeftScroll;
    BOOL _isRootScroll;
    
    NSMutableArray *_viewArray;
}

@property(nonatomic, readonly) UIScrollView *scrollView;
@property(nonatomic, assign) NSUInteger selectedIndex;
@property(nonatomic, assign) id<SlideSwitchViewDelegate> delegate;

- (void)reloadData;
 
@end

@protocol SlideSwitchViewDelegate <NSObject>

@required

/*!
 * @method 顶部tab个数
 * @abstract
 * @discussion
 * @param 本控件
 * @result tab个数
 */
- (NSUInteger)numberOfTabs:(SlideSwitchView *)view;

/*!
 * @method 每个tab所属的viewController
 * @abstract
 * @discussion
 * @param tab索引
 * @result viewController
 */
- (UIViewController *)slideSwitchView:(SlideSwitchView *)view viewOfTab:(NSUInteger)number;

@optional

/*!
 * @method 滑动左边界时传递手势
 * @abstract
 * @discussion
 * @param   手势
 * @result
 */
- (void)slideSwitchView:(SlideSwitchView *)view panLeftEdge:(UIPanGestureRecognizer *)panGesture;

/*!
 * @method 滑动右边界时传递手势
 * @abstract
 * @discussion
 * @param   手势
 * @result
 */
- (void)slideSwitchView:(SlideSwitchView *)view panRightEdge:(UIPanGestureRecognizer *)panGesture;

/*!
 * @method 点击tab
 * @abstract
 * @discussion
 * @param tab索引
 * @result
 */
- (void)slideSwitchView:(SlideSwitchView *)view didSelectTab:(NSUInteger)number;

@end
